package com.joshua.spring.gateway.controller;

import com.joshua.spring.entity.em.ResponseEnum;
import com.joshua.spring.entity.vo.GlobalResponse;
import com.joshua.spring.exception.MicroServiceException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * projectName dragon-cloud
 * package com.joshua.spring.gateway.controller
 * classname  FallbackController
 * <p>
 * description 熔断接口
 * </p>
 *
 * @author <a href="mailto:joshualwork@163.com">joshua_liu</a>
 * @date 2020/9/15 17:44
 */
@Slf4j
@RestController
@RequestMapping("dragon-gty/fallback")
public class FallbackController {

    @GetMapping
    public GlobalResponse fallback(ServerHttpRequest request) {
        log.info("request break,");
        throw MicroServiceException.builder(ResponseEnum.REQUEST_BREAKING);
    }
}
